drop support for QtWebKit. (#680)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Fri, 5 Feb 2021 17:01:41 +0000 (10:01 -0700)
committerGitHub <noreply@github.com>
Fri, 5 Feb 2021 17:01:41 +0000 (10:01 -0700)
Our QtWebKit build didn't work any longer on Ubuntu bionic or focal,
but went into an infinite loop if map preview was used.
I observed this behavior with builds of 1.7.0 as well.

Document exisiting gui configuration option disable-mappreview.

I note that latest fedora build spec falls back to QtWebKit on some
architectures where QtWebEngine is not available.  This change will
require them to fall back to disabling the map preview instead.
https://src.fedoraproject.org/rpms/gpsbabel/blob/rawhide/f/gpsbabel.spec

QtWebEngine appears to be coming to Qt6 with or after 6.2.
https://bugreports.qt.io/browse/QTBUG-63235

GPSBabel.pro
INSTALL
gui/CMakeLists.txt
gui/app.pro
gui/map.cc
gui/map.h

index f9ed6ecea5b61671d238727613253bc36bfd9773..b219381594835254b7b930c2991ab4eba08395cf 100644 (file)
@@ -362,7 +362,10 @@ equals(PWD, $${OUT_PWD}) {
 QMAKE_EXTRA_TARGETS += gpsbabel.pdf
 
 gui.depends = $(TARGET) FORCE
-gui.commands += cd gui; $(QMAKE) app.pro && $(MAKE)
+disable-mappreview {
+  guiconfig = "CONFIG+=disable-mappreview"
+}
+gui.commands += cd gui; $(QMAKE) $${guiconfig} app.pro && $(MAKE)
 QMAKE_EXTRA_TARGETS += gui
 
 unix-gui.depends = gui FORCE
diff --git a/INSTALL b/INSTALL
index 9f7da6c31aaaca750852c0e79c9f625bc6870f0a..01591a79b2fa011282d3f4bbffffe9cb1c06190f 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -32,11 +32,17 @@ WITH_ZLIB=no|pkgconfig|included*|custom
   custom: build with user supplied zlib. LIBS and INCLUDEPATH may need to be
     set, e.g. LIBS+=... INCLUDEPATH+=...
 
+CONFIG+=disable-mappreview
+  This options disables the map preview feature.  With the feature disabled
+  QtWebEngine and QtWebEngineWdigets are not used. Note that QtWebKit and
+  QtWebKitWidgets are not longer supported.
+
 DOCVERSION=...
   string appended to documentation location for www.gpsbabel.org.  The default
   value is the version string, e.g. "1.7.0".  This is used by the gpsbabel.org
   target, you are unlikely to need it unless you are maintaining
   www.gpsbabel.org.
+
 WEB=DIR
   Path where the documentation will be stored for www.gpsbabel.org.  This is
   used by the gpsbabel.org target, you are unlikely to need it unless you are
index 99b157e44917ccdeb6febf5ef0458be9ae00ce1f..8aa576989554afdefd72ebf91d42f8c4319bc69b 100644 (file)
@@ -31,7 +31,6 @@ endif()
 # hard code webengine instead of webkit for now
 find_package(Qt5 COMPONENTS WebEngineWidgets WebChannel REQUIRED)
 list(APPEND QT_LIBRARIES Qt5::WebEngineWidgets Qt5::WebChannel)
-add_definitions(-DHAVE_WEBENGINE)
 
 if(APPLE)
   find_library(IOKIT_LIBRARIES IOKit)
index 4d20d0d83448a031a2b098ef9c3d4fffe0ecf32f..f35531dc799d727e854019fe6159dc4df7ef8886 100755 (executable)
@@ -18,12 +18,7 @@ QT += core \
 disable-mappreview {
   DEFINES += DISABLE_MAPPREVIEW
 } else {
-  qtHaveModule(webenginewidgets) {
-    QT += webenginewidgets webchannel
-    DEFINES += HAVE_WEBENGINE
-  } else {
-    QT += webkit webkitwidgets 
-  }
+  QT += webenginewidgets webchannel
 }
 
 unix:DESTDIR = objects
index aac5d5729e6089ea07200b934f57f581bfd7a82a..caccc4642137f5a5aa5e74aa6ab1681f604e6b55 100644 (file)
 #include <QNetworkRequest>
 #include <QMessageBox>
 #include <QNetworkAccessManager>
-#if HAVE_WEBENGINE
 #include <QWebEngineView>
 #include <QWebEnginePage>
 #include <QWebChannel>
-#else
-#include <QWebView>
-#include <QWebFrame>
-#include <QWebPage>
-#endif
 #include <QApplication>
 #include <QCursor>
 #include <QFile>
@@ -62,11 +56,7 @@ static QString stripDoubleQuotes(const QString& s)
 //------------------------------------------------------------------------
 Map::Map(QWidget* parent,
          const Gpx&  gpx, QPlainTextEdit* te):
-#if HAVE_WEBENGINE
   QWebEngineView(parent),
-#else
-  QWebView(parent),
-#endif
   gpx_(gpx),
   mapPresent_(false),
   busyCursor_(false),
@@ -80,7 +70,6 @@ Map::Map(QWidget* parent,
           this,SLOT(loadFinishedX(bool)));
   this->logTime("Start map constructor");
 
-#if HAVE_WEBENGINE
   auto* mclicker = new MarkerClicker(this);
   auto* channel = new QWebChannel(this->page());
   this->page()->setWebChannel(channel);
@@ -88,7 +77,6 @@ Map::Map(QWidget* parent,
   channel->registerObject(QStringLiteral("mclicker"), mclicker);
   connect(mclicker, SIGNAL(markerClicked(int,int)), this, SLOT(markerClicked(int,int)));
   connect(mclicker, SIGNAL(logTime(QString)), this, SLOT(logTime(QString)));
-#endif
 
   // We search the following locations:
   // 1. In the file system in the same directory as the executable.
@@ -177,15 +165,6 @@ static QString makePath(const vector <LatLng>& pts)
 //------------------------------------------------------------------------
 void Map::showGpxData()
 {
-
-#if !defined(HAVE_WEBENGINE)
-  // Historically this was done here in showGpxData.
-  MarkerClicker* mclicker = new MarkerClicker(this);
-  this->page()->mainFrame()->addToJavaScriptWindowObject("mclicker", mclicker);
-  connect(mclicker, SIGNAL(markerClicked(int,int)), this, SLOT(markerClicked(int,int)));
-  connect(mclicker, SIGNAL(logTime(QString)), this, SLOT(logTime(QString)));
-#endif
-
   this->logTime("Start defining JS string");
   QStringList scriptStr;
   scriptStr
@@ -406,11 +385,7 @@ void Map::panTo(const LatLng& loc)
 //------------------------------------------------------------------------
 void Map::resizeEvent(QResizeEvent* ev)
 {
-#if HAVE_WEBENGINE
   QWebEngineView::resizeEvent(ev);
-#else
-  QWebView::resizeEvent(ev);
-#endif
   if (mapPresent_) {
     evaluateJS(QString("google.maps.event.trigger(map, 'resize');"));
   }
@@ -461,11 +436,7 @@ void Map::evaluateJS(const QString& s, bool upd)
   *dbgout_ << s << '\n';
   dbgout_->flush();
 #endif
-#if HAVE_WEBENGINE
   this->page()->runJavaScript(s);
-#else
-  this->page()->mainFrame()->evaluateJavaScript(s);
-#endif
   if (upd) {
     this->update();
   }
index 460e1c9b71bc1ee58b0ba9ebffdca042bb5cbee7..3166ef7b8f3ebcfcea07e629a8ad44b91ba61bcf 100644 (file)
--- a/gui/map.h
+++ b/gui/map.h
 //------------------------------------------------------------------------
 #ifndef MAP_H
 #define MAP_H
-#if HAVE_WEBENGINE
 #include <QWebEngineView>
-#else
-#include <QWebView>
-#endif
 #include <QPlainTextEdit>
 #include <QElapsedTimer>
 #include <QFile>
@@ -62,11 +58,7 @@ signals:
 
 
 
-#if HAVE_WEBENGINE
 class Map : public QWebEngineView
-#else
-class Map : public QWebView
-#endif
 {
   Q_OBJECT
 public: